﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using attendance.L3Bussobject;
using attendance.L1Dataaccess;

namespace attendance.L2Busslogic
{
    public class student_infoBL
    {
        public static bool Addfill(student_infoOB myword)      //添加纪录
        {
            string ss = "INSERT INTO student_info (name,numb)VALUES('";
            ss = ss + myword.name.Trim() + "','";
            ss = ss + myword.numb.Trim() + "')";

            return student_infoDB.AddDeleteItem(ss);
        }
        public static bool deleteAll()      //删除记录
        {
            string ss = "delete from student_info '";
            return qiandaoDB.AddDeleteItem(ss);
        }
        public static student_infoOB Getwordsingle(string nameq)      //按姓名查找
        {
            string commandtext = "select * from student_info where name='" + nameq.Trim() + "'";
            student_infoOB myword = new student_infoOB();
            myword.name = "访问数据库不成功！";
            DataSet ds = null;
            ds = student_infoDB.GetItem(commandtext);
            if (ds == null)
            {
                return myword;
            }
            if (ds.Tables[0].Rows[0][0].ToString().Trim() == "defaulqwesda6588" || ds.Tables[0].Rows[0][0].ToString().Trim() == "defaulqwesda6577" || ds.Tables[0].Rows[0][0].ToString().Trim() == "-98685")
            {
                return myword;
            }

            int i = 0;

            myword.ID = ds.Tables[0].Rows[i][0].ToString().Trim();
            myword.name = ds.Tables[0].Rows[i][1].ToString().Trim();
            myword.numb = ds.Tables[0].Rows[i][2].ToString().Trim();

            return myword;
        }
    }
}